package com.ahu.json;

import com.ahu.domain.RepairCur;
import com.ahu.util.RequestException;

import java.io.Serializable;
import java.text.ParseException;
import java.util.Date;

/**
 * Created by qx on 2017/11/29.
 * 后台更改数据所需json
 */
public class RepairCurRequestJson implements Serializable{
    private Integer id;
    private String number;
    private String repairAddress;
    private String repairContext;
    private String repairType;
    private String repairTime;
    private String repairDate;
    private String tel;
    private byte[] repairImg;

    public RepairCur convertRepair(RepairCur repairCur) throws ParseException {
        repairCur.setId(getId());
        repairCur.setNumber(getNumber());
        repairCur.setRepairAddress(getRepairAddress());
        repairCur.setRepairContext(getRepairContext());
//        repairCur.setRepairTime(getRepairTime().toString());
        repairCur.setTel(getTel());
        repairCur.setRepairImage(getRepairImg());
        repairCur.setRepairType(getRepairType());
        return repairCur;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNumber() {
        if (number == null) {
            throw new RequestException("number缺失");
        }

        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getRepairAddress() {
        if (repairAddress == null) {
            throw new RequestException("address缺失");
        }

        return repairAddress;
    }

    public void setRepairAddress(String repairAddress) {
        this.repairAddress = repairAddress;
    }

    public String getRepairContext() {
        if (repairContext == null) {
            throw new RequestException("repairContext缺失");
        }

        return repairContext;
    }

    public void setRepairContext(String repairContext) {
        this.repairContext = repairContext;
    }

    public String getRepairTime() {
        if (repairTime == null) {
            throw new RequestException("repairTime缺失");
        }

        return repairTime;
    }

    public void setRepairTime(String repairTime) {
        this.repairTime = repairTime;
    }

    public String getRepairDate() {
        return repairDate;
    }

    public void setRepairDate(String repairDate) {
        this.repairDate = repairDate;
    }

    public String getTel() {
        if (tel == null) {
            throw new RequestException("tel缺失");
        }

        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

//    public String getRepairImg() {
//        if (repairImg == null) {
//            throw new RequestException("repairImg缺失");
//        }
//
//        return repairImg;
//    }
//
//    public void setRepairImg(String repairImg) {
//        this.repairImg = repairImg;
//    }


    public byte[] getRepairImg() {
        return repairImg;
    }

    public void setRepairImg(byte[] repairImg) {
        this.repairImg = repairImg;
    }

    public String getRepairType() {

        return repairType;
    }

    public void setRepairType(String repairType) {
        this.repairType = repairType;
    }
}
